Skip to content

Fix schema mismatches and auth for current Garmin Connect responses#22

Open
Shinnnyshinshin wants to merge 1 commit intoarathunku:mainfrom
Shinnnyshinshin:fix-nullable-fields-after-api-update
Open

Fix schema mismatches and auth for current Garmin Connect responses#22
Shinnnyshinshin wants to merge 1 commit intoarathunku:mainfrom
Shinnnyshinshin:fix-nullable-fields-after-api-update

Conversation

@Shinnnyshinshin
Copy link
Copy Markdown

Fix schema mismatches and auth for current Garmin Connect responses

These changes fix a set of issues that prevent the library from working out of the box when following examples/basic.livemd with a typical Garmin Connect account.

Schema fixes

Profile (api/profile.ex)

  • garminGUID: the JSON key is garminGUID, not garmin_guid — the field was never being populated. Fixed with an explicit key alias.
  • full_name, activity_power_visibility, allow_golf_live_scoring: marked as nullable, as these are absent or null on some account types.

Activity and ActivityList (api/activity.ex, api/activity_list.ex)

  • elevation_gain / elevation_loss: marked as nullable in Activity and optional + nullable in ActivityList. These fields are absent for any non-outdoor activity (strength training, yoga, treadmill runs, etc.), causing a match error for anyone whose activity history isn't exclusively outdoor.
  • description in ActivityList: marked as optional + nullable — not all activities have a description.

Auth fix (auth.ex)

get_cookie/1 returns a list of cookie strings, but put_header expects a single string. This caused auth to fail silently by sending a malformed cookie header. Fixed by joining the list with "; " in both signin_req/2 and submit_signin_req/3.

Mix config (mix.exs, mix.lock)

  • Moved preferred_cli_env into the cli/0 callback, which is the correct location in current Mix versions.
  • Bumped credo to ~> 1.7.11 to resolve a dependency conflict.

…rent Garmin API

- Mark elevation_gain/loss as nullable in Activity and optional+nullable
  in ActivityList (absent for non-outdoor activities e.g. gym workouts)
- Fix garminGUID field mapping in Profile (key was garminGUID not
garmin_guid)
- Mark full_name, activity_power_visibility, allow_golf_live_scoring as
  nullable in Profile (absent/null on some account types)
- Mark description as optional+nullable in ActivityList
- Fix cookie header serialization in auth — join list with "; " before
  setting header value
- Move preferred_envs to cli/0 per current Mix API and bump credo to
1.7.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant